package br.com.ufscar.context;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.support.AbstractContextLoader;

public class ContextLoader extends AbstractContextLoader {
	
	private ClassPathXmlApplicationContext context;

	@Override
	protected String getResourceSuffix() {
		return "-context.xml";
	}

	@Override
	public ApplicationContext loadContext(String... arg0) throws Exception {
		if (this.context == null) {
			context = new ClassPathXmlApplicationContext(new String[]{"/applicationContext.xml", "/dataSourcesContextJUnit.xml", "/hibernateSessionContextJUnit.xml"});
		}
		return context;
	}

}
